<template>
  <div class="mall">
    <div class="mallSwiper">
      <swiper :options="swiperOption" ref="mySwiper">
        <!-- slides -->
        <swiper-slide v-for="item in items" :key="item.id"><img v-bind:src="item.src" alt=""></swiper-slide>  
      </swiper>
    </div>
    <dl class="menu_mall">
      <dd>
        <div>          
          <img src="../assets/menu/hot.png" alt="">
        </div>
        <span>
          爆款
        </span>
      </dd>
      <dd>
        <div>          
          <img src="../assets/menu/sx.png" alt="">
        </div>
        <span>
          上新
        </span>
      </dd>
      <dd>
        <div>          
          <img src="../assets/menu/xsqg.png" alt="">
        </div>
        <span>
          限时抢购
        </span>
      </dd>
      <dd >
        <router-link :to="{
          path:'category',
          params:{
            column:1
          }
        }">          
          <div>          
            <img src="../assets/menu/fl.png" alt="">
          </div>
          <span>
            分类
          </span>
        </router-link>
      </dd>
      <dd>
        <div>          
          <img src="../assets/menu/fg.png" alt="">
        </div>
        <span>
          乐销专区
        </span>
      </dd>
      <dd>
        <div>          
          <img src="../assets/menu/zc.png" alt="">
        </div>
        <span>
          众筹专区
        </span>
      </dd>
      <dd>
        <div>          
          <img src="../assets/menu/dh.png" alt="">
        </div>
        <span>
          兑换专区
        </span>
      </dd>
      <dd>
        <div>          
          <img src="../assets/menu/gwc.png" alt="">
        </div>
        <span>
          购物车
        </span>
      </dd>
      <!-- 资讯 -->
      <div class="consulting">
        <img src="../assets/consult/zx.png" alt="">
        <span class="consult_txt">
          三天销售回款1个亿！！！！！，他是怎么办到的
        </span>
        |
        <span>
          更多
        </span>
      </div>
    </dl>
    <!-- 商品区 -->
    <div class="goods_mall">
      <p class="goods_describe">
        — 高端产品 平民消费 —
      </p>
      <dl class="goods_list">
        <dd  v-for="goodsList in goodsList" :key="goodsList.id">
          <div class="goods_img">
            <img src="../assets/mall/goods.jpg" alt="">
            <!-- <img v-bind:src="goodsList.img" alt=""> -->
          </div>
          <div class="goods_Sec">
            <p class="goods_title">
              {{goodsList.name}}
            </p>
            <div class="price_cart">
              <span class="goods_price">
                {{goodsList.price |currency}}
              </span>
              <div class="cart_channel">
                <div class="channel_Btn">
                  收益
                </div>
                <div class="goods_cart">
                  <img src="../assets/mall/mallCart.png" alt="">
                </div>
              </div>
            </div>
          </div>
        </dd>
      </dl>
    </div>
    <!-- tab菜单栏 -->
    <tabbar :selected='selected' :tabs='tabs'></tabbar>
  </div>
</template>
<script>
  import tabbar from '../components/tabbar'
  import { swiper, swiperSlide } from 'vue-awesome-swiper'
  export default {
    components: {tabbar, swiper, swiperSlide},
    data () {
      return {
        txt: 'This is an about page',
        // tabbar初始化
        selected: 'tab1',
        tabs: [
          require('../assets/tabs/sc.png'),
          require('../assets/tabs/zq2.png'),
          require('../assets/tabs/fx2.png'),
          require('../assets/tabs/ylc2.png'),
          require('../assets/tabs/user2.png')
        ],
        // 轮播初始化
        swiperOption: {
          autoplay: 2000,
          initialSlide: 1,
          loop: true,
          pagination: '.swiper-pagination',          
          observer: true,//修改swiper自己或子元素时，自动初始化swiper
          observeParents: true,//修改swiper的父元素时，自动初始化swiper
        },
        // 轮播图
        items: [
          {
            id:1,
            src: 'http://img.zcool.cn/community/0117e2571b8b246ac72538120dd8a4.jpg@1280w_1l_2o_100sh.jpg',
          },
          {
            id:2,
            src: 'http://img.zcool.cn/community/0117e2571b8b246ac72538120dd8a4.jpg@1280w_1l_2o_100sh.jpg',
          },
          {
            id:3,
            src: 'http://img.zcool.cn/community/0117e2571b8b246ac72538120dd8a4.jpg@1280w_1l_2o_100sh.jpg',
          },
          {
            id:4,
            src: 'http://img.zcool.cn/community/0117e2571b8b246ac72538120dd8a4.jpg@1280w_1l_2o_100sh.jpg',
          }
        ],
        // 商品列表
        goodsList: [
          {
            id:0,
            img: '../assets/mall/goods.jpg',
            name: '麻小辫松茸金笋/出口产品',
            price: 336
          },
          {
            id:1,
            img: '../assets/mall/goods.jpg',
            name: '麻小辫松茸金笋/出口产品',
            price: 336
          },
          {
            id:2,
            img: '../assets/mall/goods.jpg',
            name: '麻小辫松茸金笋/出口产品',
            price: 336
          },
          {
            id:3,
            img: '../assets/mall/goods.jpg',
            name: '麻小辫松茸金笋/出口产品',
            price: 336
          },
          {
            id:3,
            img: '../assets/mall/goods.jpg',
            name: '麻小辫松茸金笋/出口产品',
            price: 336
          }
        ]
      }
    },
    filters: {
      currency: function (value) {
        if (!value) return ''
        return '￥' + value
      }
    }
  }
</script>
<style>
/* 公用样式 */
a{
  color: black;
  text-decoration: none;
}
/* 轮播 */
.mallSwiper{
  position: relative;
  height: 10rem;
  overflow: hidden;
}
.mallSwiper .swiper-container{
  height: 100%;
}
.mallSwiper img{
  height:100%;
}
/* 菜单 */
.menu_mall{
  display:flex;
  flex-direction: row;
  justify-content: space-between;
  flex-wrap: wrap;
  background-color: white;
  padding: .8rem .8rem .8rem .3rem;
  font-size: .8rem;
  box-sizing: border-box;
}
.menu_mall dd{
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width:20%;
  margin-left: 2%;
  padding: .5rem;
  box-sizing: border-box;
}
.menu_mall dd div{
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  box-sizing: border-box;
}
.menu_mall dd img{
  width: 100%;
}
/* 资讯 */
.consulting{
  display:flex;
  flex-direction: row;
  justify-content: space-between;
  padding: .5rem 0;
  width: 90%;
  margin-left: 5%;
  box-sizing: border-box;
}
.consulting img{
  height: 1rem;
}
.consult_txt{
  width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 商品区 */
.goods_mall{
  background-color: white;
  margin-top: .5rem;
  padding-top: .5rem;
}
.goods_describe{
  font-size: .8rem;
  color: #999;
}
/* 商品列表 */
.goods_list{
  display: flex;
  flex-direction: row;
  justify-content: left;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  flex-wrap: wrap;
  margin-top: .5rem;
  font-size: .75rem;
}
.goods_list dd{
  width: 47.5%;
  -moz-box-shadow: 0rem 1rem 2.5rem 0rem rgba(185,182,168,0.5); 
  -webkit-box-shadow: 0rem 1rem 2.5rem 0rem rgba(185,182,168,0.5); 
  box-shadow: 0rem 1rem 2.5rem 0rem rgba(185,182,168,0.5); 
  border-radius: .8rem;
  overflow: hidden;
  margin-left: 1.5%;
  margin-bottom: .5rem;
}
.goods_img{
  width: 100%;
  height: 8rem;
}
.goods_img img{
  width: 100%;
  height: 100%;
}
.goods_Sec{
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  text-align: center;
  padding: .8rem;
}
.goods_title{
  font-size: .9rem;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.price_cart{  
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  text-align: center;
}
.goods_price{
  font-size: 1rem;
  color: red;
}
.goods_cart{
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid rgba(231, 224, 255,.8);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: .3rem;
  box-sizing: border-box;
}
.cart_channel{  
  display: flex;
  flex-direction: row;  
  justify-content: space-around;
  align-items: center;
}
.channel_Btn{
  margin-right: .2rem;
  border: 1px solid #999;
  padding: .2rem .3rem;
  border-radius: 1rem;
  font-size: .6rem;
}
.goods_cart img{
  width: 80%;
}
</style>
